home *** CD-ROM | disk | FTP | other *** search
- using System;
- using System.IO;
- using System.Web;
- using System.Web.UI;
- using System.Xml;
-
- namespace gbweb
- {
- /// <summary>
- /// Summary description for Header.
- /// </summary>
- public partial class Header2 : UserControl
- {
-
- protected void Page_Load(object sender, EventArgs e)
- {
- getTheme();
- }
-
- protected void Page_PreRender(object sender, System.EventArgs e)
- {
-
- }
-
- #region Web Form Designer generated code
- override protected void OnInit(EventArgs e)
- {
- //
- // CODEGEN: This call is required by the ASP.NET Web Form Designer.
- //
- InitializeComponent();
- base.OnInit(e);
- }
-
- /// <summary>
- /// Required method for Designer support - do not modify
- /// the contents of this method with the code editor.
- /// </summary>
- private void InitializeComponent()
- {
-
- }
- #endregion
-
- private void getTheme()
- {
- //Check to see if the theme has been set in session and that the set theme is using the css view
- string theme = Convert.ToString(Session["theme"]);
-
- if (theme != null && theme != "" && theme.Substring(0, 7) == "themes2" )
- {
- return;
- }
- else
- {
- //Since the session theme variable was not set or is using the table view we need to read the value from the cookie
- HttpCookie cookie = Request.Cookies["theme"];
- if (cookie != null && cookie.Value.Length > 0)
- {
- theme = cookie.Value;
- }
- else
- {
- theme = "Default";
- }
-
- //Verify that that the theme in the cookie is available in the CSS based selections. If it is not found set the theme to Default.
- if (File.Exists(HttpContext.Current.Server.MapPath("~/themes2/") + theme + "/styles.css"))
- {
- Session["theme"] = "themes2/" + theme;
- }
- else
- {
- Session["theme"] = "themes2/Default";
- }
-
- return;
- }
- }
-
- }
- }
-